import request from "./request";

//请假审批
export class AskBreakApprovalApi {
    getApprovalList({page, leave_type}) {
        let data = {page, leave_type}
        //leave_type:审批类型：student,teacher  leave_id:请假id
        return request({url: '/api/v1/leave/audit/list', method: 'post', data})
    }

    getApprovalDetail({leave_type, leave_id}) {
        let data = {leave_type, leave_id}
        return request({url: '/api/v1/leave/audit/detail', method: 'post', data})
    }

    getApprovalHistory({page = 1, leave_type, user_id}) {
        let data = {page, leave_type, user_id}
        //leave_type:审批类型：student,teacher
        //user_id:用户id,student时为学生id，反之教师id
        return request({url: '/api/v1/leave/audit/history', method: 'post', data})
    }

    agreeApproval({leave_type, leave_id, start_time, end_time, class_date}) {
        let data = {leave_type, leave_id, start_time, end_time, class_date}
        return request({url: '/api/v1/leave/audit/agree', method: 'post', data})
    }

    refuseApproval({leave_type, leave_id, reply_content}) {
        let data = {leave_type, leave_id, reply_content}
        return request({url: '/api/v1/leave/audit/refused', method: 'post', data})
    }
}

//备忘录
export class TodoApi {
    createTodo({title, description, remind_time}) {
        let data = {title, description, remind_time}
        return request({url: '/api/v1/memo/create', method: 'post', data})
    }

    getTodoList(memo_type) {
        let data = {memo_type} //memo_type:备忘录类型,0待处理1已处理
        return request({url: '/api/v1/memo/list', method: 'post', data})
    }

    deleteTodo(memo_id) {
        let data = {memo_id} //memo_id:备忘录id数组
        return request({url: '/api/v1/memo/remove', method: 'post', data})
    }
}

//建议反馈
export class SuggestBackApi {
    getSuggestList(page) {
        let data = {page}
        return request({url: '/api/v1/feedback/list', method: 'post', data})
    }
}
